//
//  KYdoctorReceivingSettingView.m
//  kuaiyi
//
//  Created by 杨亮 on 16/3/17.
//  Copyright © 2016年 kuaiyi. All rights reserved.
//

#import "KYdoctorReceivingSettingView.h"
#import <Masonry.h>
#import "Header.h"
#import "KYDoctorReceivingSettingModel.h"
#import "KYMatchDorctorModel.h"
#import <SDWebImage/UIImageView+WebCache.h>

@implementation KYdoctorReceivingSettingView
- (instancetype)init
{
    self = [super init];
    if (self) {
        [self setUpUI];
    }
    return self;
}
-(void)setUpUI{
    UIImageView *image = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"content_img_01"]];
    
    UILabel *label1 = [[UILabel alloc]init];
    label1.text = @"基本条件";
    label1.textColor = topTextColor;
    
    UILabel *contentLabel = [[UILabel alloc]init];
    contentLabel.text = @"需要提供钱\n需要提供病历";
    contentLabel.numberOfLines = 0;
    contentLabel.textColor = [UIColor grayColor];
    contentLabel.font = [UIFont systemFontOfSize:15];
    
    UILabel *extraLabel = [[UILabel alloc]init];
    extraLabel.numberOfLines = 0;
    extraLabel.textColor = [UIColor grayColor];
    extraLabel.font = [UIFont systemFontOfSize:15];
    
    [self addSubview:image];
    [self addSubview:label1];
    [self addSubview:contentLabel];
    [self addSubview:extraLabel];
    
    [image mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.mas_top).offset(10);
        make.left.equalTo(self.mas_left).offset(10);
        make.width.height.equalTo(@20);
    }];
    [label1 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.mas_top).offset(10);
        make.left.equalTo(image.mas_right).offset(10);
    }];
    [contentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(image.mas_bottom).offset(10);
        make.left.equalTo(self.mas_left).offset(10);
        make.right.equalTo(self.mas_right).offset(-10);
    }];
    [extraLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(contentLabel.mas_bottom).offset(10);
        make.left.equalTo(self.mas_left).offset(10);
        make.right.equalTo(self.mas_right).offset(-10);
    }];
    
    [KYDoctorReceivingSettingModel getDoctorReceivingSettingModelWithDoctor_id:self.matchDorctorModel.doctor_id success:^(KYDoctorReceivingSettingModel *model) {
        NSArray *stringArray = model.receiving_settings;
        NSString *mutStr = [NSString string];
        for (NSString *subString in stringArray) {
            NSString *tempStr = [NSString stringWithFormat:@"%@\n",subString];
            mutStr = [mutStr stringByAppendingString:tempStr];
        }
        extraLabel.text = model.receiving_setting_extra;
        contentLabel.text = mutStr;
    }];
}

@end
